package com.andrew.pegSolitareEngine;

import java.util.ArrayList;

import android.content.Context;
import android.view.ViewGroup;

public class Board extends ViewGroup{
	private Hole [][] arraysOfHoles; // 2d jagged array of holes
	private final int SIZE_OF_BOARD = 5;  // SIZE_OF_BOARD refers the the length of one side
	
	public Board(Hole [][] arraysOfHoles, Context context){
		super(context);
		this.arraysOfHoles = arraysOfHoles;
	}
	
	public int countHoles(){
		int count = 0;
		// loop through array of rows	
		for (int rowId=0; rowId < arraysOfHoles.length; rowId++){
			
			// loop through row
			for (int columnId=0; columnId < arraysOfHoles[rowId].length; columnId++)	{			
				count++;
			}
		}
		return count;
	}
	
	public ArrayList<Hole> listOfHoles(){
		
		ArrayList<Hole> listOfHoles = new ArrayList<Hole>();
		
		// loop through rows
		for (int rowId=0; rowId < arraysOfHoles.length; rowId++){
			
			// loop through columns
			for (int columnId=0; columnId < arraysOfHoles[rowId].length; columnId++)	{
					listOfHoles.add(arraysOfHoles[rowId][columnId]);
			}
		}	
		
		return listOfHoles;
	}

	@Override
	protected void onLayout(boolean changed, int l, int t, int r, int b) {
		// TODO Auto-generated method stub
		
	}		
}